home *** CD-ROM | disk | FTP | other *** search
- ; delay.asm --> a program to slow the computer down. especially nice if you
- ; have an IBM AT or compatible or an IBM AT that is running
- ; faster than the normal 6 megahertz. this program was written
- ; specifically for playing games on an AT at a normal playing
- ; speed relative to the IBM PC. however, there may be other uses
- ; yet unknown to me. to change the amount of delay, change the
- ; value after the equ in delay_count. a value of 55h slows my
- ; 8 megahertz at to slightly faster than IBM PC as reported by
- ; Peter Norton's utility SI (system information). the value
- ; reported is 1.1 relative to an IBM PC. of course, there may
- ; game programs that automatically compensate for the increased
- ; speed of an AT and this program would then be useless. for
- ; example, sublogic's jet simulator (it looks fantastic at 8
- ; megahertz). however, other games such as digdug, zaxxon, and
- ; startrek, just to name a few are a lot easier to play with the
- ; delay than at 8 megahertz (it's like driving down the highway
- ; at 450 mph.)
- ;
- ; Note: this program uses the timer interrupt and speeds up the
- ; number of interrupts from 18.2 to 256 per second.
- ; however, this speedup is offset so that the clock ticks
- ; properly.
- ;
- ; Marvin E. Wilborne III
- ; Route 5 Box 314
- ; Danville, Va. 24540
- ;
- ; Copyright (c) 1985, All rights reserved, Worldwide.
- ; This program may be copied, and distributed for free in its
- ; original unmodified form only. This notice cannot be deleted.
-
- delay_count equ 55h ; change this value for
- ; different delay times
-
- abs0 segment at 0h
-
- org 4*8h
-
- tickint dd ?
-
- ; interrupt 66h is a user-defined interrupt that is used in conjunction with
- ; delay.com to identify it as already being loaded. other applications
- ; may take over the timer interrupt and then this program would not be able to
- ; find itself and would make another copy memory resident.
-
- org 4*66h
-
- userint dd ?
-
- abs0 ends
-
- code segment public 'CODE'
- org 100h
-
- assume cs:code,ds:code,es:nothing
- start: jmp delay_init
-
- idbyte db '@DELAY.COM' ; identify this as delay.com
- oldint dd 0 ; the original interrupt addr
- timer_count db 0 ; the current number of ticks
- delay_amount db delay_count ; the default delay counter
-
- delay_int proc far
- assume cs:code,ds:nothing,es:nothing
- push ax ; save the registers used
- push bx
- inc timer_count ; 256 interrupts yet?
- jnz skip_normal ; no, delay a while
- pop bx ; retore the registers
- pop ax
- jmp oldint ; execute the normal timer int
- skip_normal: mov bl,[delay_amount] ; get the delay count
- delay_loop: dec bl ; subtract 1
- jnz delay_loop ; loop until zero
- mov al,20h ; this is the 255 out of 256
- out 20h,al ; send EOI to interrupt cntrlr
- pop bx ; restore those registers and
- pop ax
- iret ; return
-
- delay_int endp
-
- lastbyte label byte ; last needed byte in resident
- ; code
-
- installed db 0 ; flag byte for already inst
-
- assume cs:code,ds:code,es:abs0
- delay_init proc
-
- ; first determine if the program is already memory resident
-
- push ds ; save ds
- sub ax,ax ; ax = 0
- mov ds,ax ; ds = ax
- mov ax,word ptr [ds:19ah] ; get int 66h current segm
- mov ds,ax ; ds = ax
- mov cx,ax ; save ax for later
- cmp byte ptr [ds:103h],'@' ; is the id byte there?
- jnz not_inst ; no, delay not installed yet
- pop ds ; restore ds
- mov [installed],1 ; set installed flag
- jmp parm_entr ; see if any parms were entered
-
- not_inst: pop ds ; restore ds
- sub ax,ax ; ax = 0
- mov es,ax ; es = ax
- mov ax,word ptr tickint ; get the original int addr
- mov bx,word ptr tickint+2 ; get the original int segm
- mov word ptr oldint,ax ; save the address
- mov word ptr oldint+2,bx ; save the segment
- cli ; no interrupts allowed
- mov ax,offset delay_int ; get new int addr
- mov bx,cs ; use this segment
- mov word ptr tickint,ax ; save the new int addr
- mov word ptr tickint+2,cs ; save the new int segm
- mov word ptr userint,ax ; save the new int 66h addr
- mov word ptr userint+2,cs ; save the new int 66h segm
- ;
- ; speedup timer chip by 256
- ;
- mov al,00110110b
- out 43h,al
- mov al,0
- out 40h,al
- mov al,1
- out 40h,al
- ;
- ; get the delay off the command line if it was entered.
- ; for example to get a delay of 35 counts, type:
- ;
- ; DELAY <ALT><3><5> <RETURN>
- ;
- ; this means enter the code 35 by using the ALT key and the numeric keypad
- ; note this method doesn't work if prokey is loaded and active.
- ;
- ; Legal values are from 0 to 255 (0 is the longest delay ==> 256)
- ;
-
- parm_entr: cmp byte ptr [cs:80h],2 ; any parms entered?
- jnz def_delay ; no, go ahead and exit
- mov al,[cs:82h] ; yes, get the byte
- cmp [installed],1 ; already installed?
- je inst_value ; yes, change resident value
- mov [delay_amount],al ; make it the new default
- jmp def_delay
- inst_value: push ds ; save ds
- push cx ; push old ds saved in cx
- pop ds ; get ds off of stack
- mov [ds:112h],al ; move new delay into resident
- ; delay amount location
- pop ds ; restore original ds
-
- def_delay: cmp [installed],1 ; already installed?
- je inst_exit ; exit normally, do not remain
- ; memory resident
- sti
- mov dx,offset lastbyte ; get the ending address
- int 27h ; exit and stay resident
- inst_exit: int 20h ; terminate
-
- delay_init endp
-
- code ends
- end start